import sys
from PyQt5.QtWidgets import QApplication
from PyQt5.QtGui import QFont
import UI_1
import UI_3
import UI_4


def tab_select(index: list[str]):
    window1 = UI_3.ChoiceTable(index)
    window1.selected_workbook_tables.connect(table_select)
    window1.exec_()


def table_select(prefix: str, index: dict):
    new_dict = {prefix + '/' + key: value for key, value in index.items()}
    window1 = UI_4.TableView(new_dict)
    window1.exec_()


if __name__ == '__main__':
    app = QApplication(sys.argv)
    font = QFont("Arial", 12)
    app.setFont(font)
    window = UI_1.DataAnalysis()
    window.show_table_selection_signal.connect(tab_select)
    sys.exit(app.exec_())
